import { useRef, useEffect } from "react";

const DesktopDisplay = () => {
  const videoRef = useRef<HTMLVideoElement>(null);

  useEffect(() => {
    navigator.mediaDevices
      .getDisplayMedia({
        video: true,
        audio: false,
      })
      .then((mediaStream) => {
        if (videoRef.current) {
          videoRef.current.srcObject = mediaStream;
        }
      });
  }, []);
  return (
    <>
      <h1>Desktop</h1>
      <div>
        <video ref={videoRef} autoPlay playsInline></video>
      </div>
    </>
  );
};

export default DesktopDisplay;
